﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Resources;
using System.Globalization;
using Google.GData.Client;
using Google.GData.Extensions.AppControl;
using Google.GData.Extensions.Apps;
using Google.GData.Extensions.Exif;
using Google.GData.Extensions.Location;
using Google.GData.Extensions.MediaRss;
using Google.GData.YouTube;
using Google.YouTube;

namespace WLS
{
    public partial class Youtube_wf : Form
    {
        data video;
        all_setting p;
        string logaddelete;
        string logadd;
        string incorect;

        public Youtube_wf(data video_, ref all_setting _jazyk)
        {
            InitializeComponent();
            video = video_;
            p = _jazyk;
            p.JazykZmenen += new all_setting.ZmenaJazyku(jazyk_JazykZmenen);
            jazyk_JazykZmenen(p.jazyk);
        }


        /// <summary>
        /// Změní jazyk
        /// </summary>
        /// <param name="jazyk"></param>
        void jazyk_JazykZmenen(string jazyk)
        {
            CultureInfo cultura = CultureInfo.CreateSpecificCulture(jazyk);
            ResourceManager manager = new ResourceManager("WLS.Res", typeof(title).Assembly);
            label2.Text = manager.GetString("name", cultura);
            label1.Text = manager.GetString("description", cultura);
            menuItem1.Text = manager.GetString("back", cultura);
            menuItem2.Text = manager.GetString("add", cultura);
            this.Text = manager.GetString("titleYT", cultura);
            logadd = manager.GetString("logadd", cultura);
            logaddelete = manager.GetString("logaddelete", cultura);
            incorect = manager.GetString("incorect", cultura);
            comboBox1.Items[0] = manager.GetString("autos", cultura);
            comboBox1.Items[1] = manager.GetString("comedy", cultura);
            comboBox1.Items[2] = manager.GetString("education", cultura);
            comboBox1.Items[3] = manager.GetString("entertainment", cultura);
            comboBox1.Items[4] = manager.GetString("film", cultura);
            comboBox1.Items[5] = manager.GetString("gaming", cultura);
            comboBox1.Items[6] = manager.GetString("howto", cultura);
            comboBox1.Items[7] = manager.GetString("music", cultura);
            comboBox1.Items[8] = manager.GetString("news", cultura);
            comboBox1.Items[9] = manager.GetString("nonprofits", cultura);
            comboBox1.Items[10] = manager.GetString("people", cultura);
            comboBox1.Items[11] = manager.GetString("pets", cultura);
            comboBox1.Items[12] = manager.GetString("science", cultura);
            comboBox1.Items[13] = manager.GetString("sports", cultura);
            comboBox1.Items[14] = manager.GetString("travel", cultura);
            //comboBox1.SelectedItem = comboBox1.Items[0];
        }

        private void Youtube_wf_Load(object sender, EventArgs e)
        {
            if (this.Tag != null) video = (data)this.Tag;
            textBox1.Text = ((youtube)((data)video).yout).summary;
            textBox2.Text = ((youtube)((data)video).yout).filesetname;
            textBox3.Text = ((youtube)((data)video).yout).keywords;
            if (((youtube)((data)video).yout).category != -1)
                comboBox1.SelectedItem = comboBox1.Items[((youtube)((data)video).yout).category];
            else
                comboBox1.SelectedIndex = 0;
            checkBox1.Checked = ((youtube)((data)video).yout).type;
        }

        private void menuItem1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void menuItem2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && comboBox1.Text != "")
            {
                video.yout = new youtube(textBox2.Text, textBox1.Text, comboBox1.SelectedIndex, textBox3.Text, checkBox1.Checked);
                this.Close();
            }
            else
                MessageBox.Show(incorect);


           


        }
    }
}